﻿@model Item
@using ShoppingWebPage.Models;

<fieldset>
    @Html.HiddenFor(model => model.id)
    @Html.HiddenFor(model => model.name)
    @Html.DisplayFor(model => model.name)
    @Html.HiddenFor(model => model.price)
    @Html.DisplayFor(model => model.price, new { id = "itemPrice" })
    @Html.TextBoxFor(model => model.quantity, new {id = "txtQuantity", style = "width: 25px;height: 15px" })
    @Html.DisplayFor(model => model.itemTotalPrice, new { id = "itemTotalPrice"})
</fieldset>

<script type ="txt/javascript">
$(function () {
    $('#txtQuantity').blur(function () {
        var newQuantity = Number($(this).val());
        var itemPrice = Number($('#itemPrice').val());
        var itemTotalPrice = Number($('#itemTotalPrice').val());
        var newtotal = newQuantity * itemPrice;
        $('#itemTotalPrice').val(newtotal);
    });
});
</script>
